import 'package:freezed_annotation/freezed_annotation.dart';
import 'dart:convert';

part 'get_catgory_response.freezed.dart';
part 'get_catgory_response.g.dart';

@freezed
class GetCatgoryResponse with _$GetCatgoryResponse {
  const factory GetCatgoryResponse({
    @JsonKey(name: 'code') required int code,
    @JsonKey(name: 'msg') required String msg,
    @JsonKey(name: 'time') required int time,
    @JsonKey(name: 'data') required List<Datum> data,
  }) = _GetCatgoryResponse;

  factory GetCatgoryResponse.fromJson(Map<String, dynamic> json) =>
      _$GetCatgoryResponseFromJson(json);
}

@freezed
class Datum with _$Datum {
  const factory Datum({
    @JsonKey(name: 'id') required int id,
    @JsonKey(name: 'title') required String title,
    @JsonKey(name: 'title_sub') required String titleSub,
    @JsonKey(name: 'image') required String image,
    @JsonKey(name: 'sort') required int sort,
    @JsonKey(name: 'status') required int status,
    @JsonKey(name: 'create_time') required int createTime,
    @JsonKey(name: 'admin_id') required int adminId,
    @JsonKey(name: 'fid') required int fid,
    @JsonKey(name: 'banner') required String banner,
    @JsonKey(name: 'follow_num') required int followNum,
    @JsonKey(name: 'is_tui') required int isTui,
    @JsonKey(name: 'is_sh') required int isSh,
    @JsonKey(name: 'goods_num') required int goodsNum,
    @JsonKey(name: 'hot') required int hot,
    @JsonKey(name: 'bg') required String bg,
  }) = _Datum;

  factory Datum.fromJson(Map<String, dynamic> json) => _$DatumFromJson(json);
}
